'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class Author extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here
    }
  }
  Author.init({
    name: {
      allowNull: false,
      validate: {
        notNull: {msg: '名称必须'},
        notEmpty: {msg: '名称不能为空'}
      },
      type: DataTypes.STRING
    },
    introZh: DataTypes.TEXT,
    introEn: DataTypes.TEXT,
    avatar: DataTypes.STRING,
    link: DataTypes.STRING
  }, {
    sequelize,
    modelName: 'Author',
  });
  return Author;
};